package com.zero.barbecue.ooi;

import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
public class IndexController implements ErrorController {

    @GetMapping
    public void requestIndex(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.getWriter().write("<html><center><a href='error'><h1>barbecue</h1><h3 style='color:orange;'>zero room 2022</h3></a></center></html>");
    }

    @GetMapping("error")
    public String responseErrorInfo(HttpServletRequest request) {
        System.out.println("i got message");
        return "hint/error.html";
    }

    @Override
    public String getErrorPath() {
        return null;
    }
}
